/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package evocarcassonne.core.elements;

import evocarcassonne.core.board.Tile;
import evocarcassonne.core.utils.Feature;

import java.util.List;

/**
 * @author pnaubourg
 */
public class City extends Element {

    public City(Tile tile, List<Feature> feats) {
        super(tile, feats);
    }

    public int evaluate() {

        int value = getTiles().size();

        for (Feature feat : getFeatures()) {

            if (feat == Feature.Shield1)
                value += 1;
            else if (feat == Feature.Shield2)
                value += 2;
            else if (feat == Feature.Shield3)
                value += 3;
        }

        int mult = 1;

        if (isComplete()) {

            mult = 2;
            if (getFeatures().contains(Feature.Cathedral)) {
                mult = 3;
            }

        } else {

            if (getFeatures().contains(Feature.Cathedral)) {
                mult = 0;
            }
        }


        value *= mult;

        return value;
    }
}
